<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>打印二维码</title>
		<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
		<style type="text/css">
			.button-div{
				height: 60px;
				width: 650px;
				margin: auto;
				text-align: center;
				line-height: 60px;
			}
			.button-submit{
				display: inline-block;
				height: 38px;
				line-height: 38px;
				padding: 0 18px;
				background-color: #009688;
				color: #fff;
				white-space: nowrap;
				text-align: center;
				font-size: 14px;
				border: none;
				border-radius: 2px;
				cursor: pointer;
			}
			.return{
				border: 1.5px solid #bdbdbd;
				background-color: #fff;
				border-color: #e6e6e6;
				color: #666;
			}
			
			.gig-div{
				height: 100%;
				width: 580px;
				margin: auto;
			}
			.margin{
				width: 96%;
				height: 240px;
				margin: auto auto 20px auto;
				background-color: #ededee;
			}
			.title-div{
				height: 20%;
				width: 100%;
				text-align: center;
				line-height: 25px;
			}
			.title-text{
				font-size: 16px;
				font-weight: 600
			}
			.note-div{
				height: 80%;
				width: 100%;
				background-color: #ededee;
			}
			.left-div{
				float:left;
				height: 180px;
				width: 44%;
				background-color: #ededee;
				border-right:1px solid #000;
			}
			.right-div{
				float:right;
				height: 180px;
				width: 55%;
				background-color: #ededee;
				background-color: #ededee;
			}
			img{
				margin-left:30px;
				width: 200px;
				height: 180px;
				padding-bottom:10px;
			}
			.right-div-div{
				height: 16%;
				font-weight: 600;
			}
		</style>
	</head>
	<body>
		<div class="button-div">
			<button class="button-submit" type="button" onclick="printing()">&emsp;Print&emsp;</button>
			<button class="button-submit return" type="button" onclick="backupPage()">&emsp;Close&emsp;</button>
		</div>
		<div class="gig-div" id="printinghtml">
			<div class="margin">
				<div class="title-div">
					<span class="title-text">12QSD8314七度空间少女特薄迷你巾12包小箱装卫生巾（B2B专供）</span>
				</div>
				<div class="note-div">
					<div class="left-div">
						<img src="/basicPosition/getqrcode?id=A111">
					</div>
					<div class="right-div">
						<div class="right-div-div"><span>商品编号：AAC00117</span></div>
						<div class="right-div-div"><span>批号：20200210</span></div>
						<div class="right-div-div"><span>入库批次：20200210</span></div>
						<div class="right-div-div"><span>数量：112</span></div>
						<div class="right-div-div"><span>托盘号：1111111111</span></div>
					</div>
				</div>
			</div>
			<div class="margin">
				<div class="title-div">
					<span class="title-text">12QSD8314七度空间少女特薄迷你巾12包小箱装卫生巾（B2B专供）</span>
				</div>
				<div class="note-div">
					<div class="left-div">
						<img src="/basicPosition/getqrcode?id=A111">
					</div>
					<div class="right-div">
						<div class="right-div-div"><span>商品编号：AAC00117</span></div>
						<div class="right-div-div"><span>批号：20200210</span></div>
						<div class="right-div-div"><span>入库批次：20200210</span></div>
						<div class="right-div-div"><span>数量：112</span></div>
						<div class="right-div-div"><span>托盘号：1111111111</span></div>
					</div>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		function getUrlParam(name) {
		    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		    var r = window.location.search.substr(1).match(reg);
		    if (r != null) {
		        return unescape(r[2]);
		    } else {
		        return null;
		    }
		};

		var str = getUrlParam("ids")
		//字符串截取为数组
		var strArr = str.split(",");
		var arr = []
		for(j = 0,len = strArr.length; j < len; j++) {
			arr.push(strArr[j])
		};

		var html = ''
		for (var i=0;i<arr.length;i++){
			$.ajax({
				type: 'get',
				data: {id:arr[i]},
				url: "/storagePutSingle/detail",
				async: false,
				dataType:"json",
				success: function (data) {
					if(data.data != null && data.data != ''){
						html += '<div class="margin">'+
							'<div class="title-div">'+
								'<span class="title-text">'+data.data.goodsname+'</span>'+
							'</div>'+
							'<div class="note-div">'+
								'<div class="left-div">'+
									'<img src="/storagePutSingle/getqrcode?id='+data.data.trayNumber+'">'+
								'</div>'+
								'<div class="right-div">'+
									'<div class="right-div-div"><span>Commodity Code：'+data.data.goodsNumber+'</span></div>'+
									'<div class="right-div-div"><span>Item No.：'+data.data.goodsNo+'</span></div>'+
									'<div class="right-div-div"><span>Batch No.：'+data.data.singleBatchnumber+'</span></div>'+
									'<div class="right-div-div"><span>Inbound Batch：'+data.data.recommend+'</span></div>'+
									'<div class="right-div-div"><span>Quantity：'+data.data.putNum+'</span></div>'+
									'<div class="right-div-div"><span>Pallet No.：'+data.data.trayNumber+'</span></div>'+
								'</div>'+
							'</div>'+
						'</div>';
					}
				}
			})
		}
		$("#printinghtml").html(html)
		
	    //返回按钮
	    function backupPage(){
	    	var Index = parent.layer.getFrameIndex(window.name);
	        parent.layer.close(Index);
	    }
	    
	    //打印按钮
	    function printing(){
	        bdhtml = window.document.body.innerHTML;
	        phtnl = window.document.getElementById("printinghtml").innerHTML;
	        window.document.body.innerHTML = phtnl; //把需要打印的指定内容赋给big
	        window.print(); //调用浏览器的打印功能打印指定区域
	        window.document.body.innerHTML=bdhtml; // 最后还原页面
	    }
	</script>
</html>
